home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9549 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: beach.and.nl!usenet
  2. From: jos@and.nl (Jos A. Horsmeier)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: do || die;
  5. Date: 11 Mar 1996 14:43:50 GMT
  6. Organization: AND Operations Research B.V.
  7. Message-ID: <4i1e76$dvq@beach.and.nl>
  8. References: <1996Mar7.052636.59812@ucl.ac.uk> <DnwJKs.KyJ@uns.bris.ac.uk> <mjs.826218466@hubcap> <1996Mar11.130836.4955@friend.kastle.com>
  9. NNTP-Posting-Host: klepzeiker.and.nl
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=ISO-8859-1
  12. X-Newsreader: WinVN 0.99.5
  13.  
  14. In article <1996Mar11.130836.4955@friend.kastle.com>, rich@kastle.com wrote:
  15. |mjs@hubcap.clemson.edu (M. J. Saltzman) wrote:
  16. |
  17. |>       i -= i != 0
  18. |>
  19. |>(which is probably what I would have written).
  20.  
  21. |Um, wouldn't that be undefined?  The value of i is stored and there
  22. |are two references to i without an intervening sequence point.  One
  23. |reference is implicit by the "-=" operator and the other is explicit.
  24.  
  25. There's nothing undefined about the expression, although it could
  26. use a couple of parentheses to avoid the confusion it just caused:
  27.  
  28.     i -= (i != 0)
  29.  
  30. This simply reads: subtract one from i if i does not equal zero.
  31.  
  32. BTW, I'm an idiot, so I would have written 'i-= !!i' instead ;-)
  33.  
  34. kind regards,
  35.  
  36. Jos aka jos@and.nl
  37. -- 
  38. Atnwgqkrl gy zit vgksr, ug qshiqwtzoeqs!
  39.  
  40.